import java.io.File;
import java.io.IOException;
import java.util.Arrays;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        File file = new File("d:/text.txt");
        System.out.println(file.exists());//false
        System.out.println(file.isDirectory());//false
        System.out.println(file.isFile());//false
        System.out.println(file.createNewFile());//true
        System.out.println(file.delete());//true
        
        //file.deleteOnExit();在程序全部执行完之后删除文件

        File file1 = new File("d:/");
        String[] ret = file1.list();
        System.out.println(Arrays.toString(ret));

        File file2 = new File("d:/aaa/bbb/ccc");
        boolean ans = file2.mkdirs();//能创建多级目录
        //file2.mkdir();只能创建一级目录，如 d:/aaa
        System.out.println(ans);
    }
}
